package chabernac.gravidroid.paint;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Paint.Style;
import android.view.View;
import chabernac.android.draw.AbstractDrawable;
import chabernac.gravidroid.model.LinearMass;

public class LinearMassDrawable extends AbstractDrawable {
	private LinearMass myLinearMass = null;
	private Paint myPaint = new Paint();
	
	public LinearMassDrawable(LinearMass aMass){
	    this(aMass, Color.YELLOW, 20);
	}
	
	public LinearMassDrawable(LinearMass aMass, int aColor, int aStrokeWidth) {
		myLinearMass = aMass;
		myPaint.setColor(aColor);
		myPaint.setStrokeWidth(aStrokeWidth);
		myPaint.setStyle( Style.FILL );
	}

	@Override
	public void paint(Canvas aCanvas, View aView) {
		aCanvas.drawLine(myLinearMass.getMass1().location.x, 
				myLinearMass.getMass1().location.y, 
				myLinearMass.getMass2().location.x, 
				myLinearMass.getMass2().location.y, 
				myPaint);
	}

}
